package info.douyi.dps.controller;

import info.douyi.dps.model.Influence;
import info.douyi.dps.service.InfluenceService;
import info.douyi.dps.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/Influence")
public class InfluenceController {

    @Autowired
    private InfluenceService influenceService;

    @GetMapping("/getPidByBid/{pid}")
    public Result<List<Integer>> getPidByBid(@PathVariable int  pid) {
        return Result.success(influenceService.findPidByBid(pid));
    }

    //通过pid添加对应的影响因素
    @PostMapping("/addInfluence")
    public Result addInfluence(@RequestBody Influence influence) {
        influenceService.addInfluence(influence);
        return Result.success();
    }
}
